package com.ruoyi.web.controller.biz;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.system.domain.BizCustomer;
import com.ruoyi.system.domain.BizInformation;
import com.ruoyi.system.service.BizCustomerService;
import com.ruoyi.system.service.BizInformationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/biz/information")
public class BizInformationController extends BaseController {

    @Autowired
    private BizInformationService informationService;


    @Anonymous
    @GetMapping("/list")
    public TableDataInfo list(BizInformation bizInformation) {
        startPage();
        List<BizInformation> bizInformationList = informationService.selectInformationList(bizInformation);
        return getDataTable(bizInformationList);
    }

    @Anonymous
    @GetMapping(value = "/queryById")
    public AjaxResult queryById(@RequestParam("id") Long id) {
        return success(informationService.selectInformationById(id));
    }

    @Anonymous
    @PostMapping("/save")
    public AjaxResult save(@RequestBody BizInformation bizInformation) {
        return toAjax(informationService.insertInformation(bizInformation));
    }

    @Anonymous
    @PutMapping("/update")
    public AjaxResult update(@RequestBody BizInformation bizInformation) {
        return toAjax(informationService.updateInformation(bizInformation));
    }

    @Anonymous
    @DeleteMapping("/delete/{id}")
    public AjaxResult delete(@PathVariable("id") Long id) {
        return toAjax(informationService.deleteInformationById(id));
    }

    @Anonymous
    @GetMapping("/queryByCondition")
    public TableDataInfo queryByCondition(BizInformation bizInformation) {
        startPage();
        List<BizInformation> informationList = informationService.selectInformationList(bizInformation);
        return getDataTable(informationList);
    }


}
